package com.kingdomi.emquantstarter;

import com.eastmoney.entity.EQData;
import com.kingdomi.emquantstarter.service.EmQuantCase;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.text.SimpleDateFormat;
import java.util.Date;

@SpringBootApplication
public class EmQuantStarterApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(EmQuantStarterApplication.class, args);
        EmQuantCase emQuantcase = run.getBean(EmQuantCase.class);
        emQuantcase.init();
        emQuantcase.start();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String today = format.format(new Date());
        String blockIds = "605008001";
        String[] idArr = blockIds.split(",");
        for(String id: idArr){
            EQData eqData = emQuantcase.sector(id,today,"");
            if(eqData != null){
                Object[][][] valArr = eqData.getValueArray();
                Object[][] valArr1 = valArr[0];
                for(int i=0;i<valArr1.length;i++){
                    String code = String.valueOf(valArr1[i][0]);
                    String fname = String.valueOf(valArr1[i][1]);
                }
            }
        }
    }

}
